package cn.mrlong.usbcamera.utils;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class CircularProgressDialog extends ProgressDialog {
    private TextView hintText;
    private String hintStr = "加载中...";

    public CircularProgressDialog(Context context) {
        super(context, cn.mrlong.mdialogstyle.R.style.loadingDialogStyle);
    }

    public void setHintText(String msg) {
        if (null != msg && !"".equals(msg)) {
            if (null == hintText) {
                return;
            }
            hintText.setVisibility(View.VISIBLE);
            hintText.setText(msg);
        } else {
            hintText.setText(msg);
            hintText.setVisibility(View.GONE);
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(cn.mrlong.mdialogstyle.R.layout.dialog_loading);
        hintText = (TextView) findViewById(cn.mrlong.mdialogstyle.R.id.tv_hint);
        hintText.setText(hintStr);
        hintText.setVisibility(View.VISIBLE);
        this.setCanceledOnTouchOutside(false);
    }

}
